﻿Imports System
Imports System.Windows.Forms
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Pipeline.Design
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Public Class PkgExecUI
    Implements IDtsComponentUI

    Dim _MetaData As Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100

    Public Sub Initialize(ByVal dtsComponentMetadata As Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100, ByVal serviceProvider As System.IServiceProvider) Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Initialize
        _MetaData = dtsComponentMetadata
    End Sub

    Public Sub Delete(ByVal parentWindow As System.Windows.Forms.IWin32Window) Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Delete

    End Sub

    Public Function Edit(ByVal parentWindow As System.Windows.Forms.IWin32Window, ByVal variables As Microsoft.SqlServer.Dts.Runtime.Variables, ByVal connections As Microsoft.SqlServer.Dts.Runtime.Connections) As Boolean Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Edit
        Dim Skel As PkgExecDlgUI = New PkgExecDlgUI
        Skel._MetaData = _MetaData
        Skel.Populate(_MetaData)
        If (Skel.ShowDialog = DialogResult.OK) Then
            Dim CProp As IDTSCustomProperty100
            For Each CProp In _MetaData.CustomPropertyCollection
                Select Case (CProp.Name)
                    Case "FileName"
                        CProp.Value = Skel.FileName.Text
                    Case "MaxDop"
                        CProp.Value = Skel.MaxDop.Text
                    Case "ColumnMapping"
                        CProp.Value = Skel.GetColumnMapping()
                End Select

            Next
            Return True
        End If
        Return False

    End Function

    Public Sub Help(ByVal parentWindow As System.Windows.Forms.IWin32Window) Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.Help

    End Sub

    Public Sub [New](ByVal parentWindow As System.Windows.Forms.IWin32Window) Implements Microsoft.SqlServer.Dts.Pipeline.Design.IDtsComponentUI.New

    End Sub
End Class
